program rgr_1_t2;
var
   n, i, j : Integer;
   m       : array[0..4] of Integer;


function f(i : Integer) : Integer;
var
   j, y : Integer;

begin
  j := 0;
  y := trunc(i/2);

  repeat
    m[j] := i - j;
    j := j + 1;
  until j > y;
  
  f := j - 1;
end;


begin
  i := 1;
  
  while i <= 9 do
  begin
    n := f(i);
    j := 1;
    write (m[0], i, 0, ' ');
    while j <= n do
    begin
      write (j, i, m[j], ' ', m[j], i, j, ' ');
      j := j + 1;
    end;
    i := i + 1;    
  end;
  
end.
